#!/usr/bin/perl

use Test::More tests => 1;
use Test::Differences;

use Perl6::Slurp;

my $generator = sub {
    return << 'END';
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title>CPAN</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<!-- Copyright Jarkko Hietaniemi <jhi@iki.fi>
     1998,1999,2000,2001,2003,2003,2004,2005,2008
     All Rights Reserved.
     The CPAN Logo provided by J.C. Thorpe.
     You may distribute this document either under the Artistic License
     (comes with Perl) or the GNU Public License, whichever suits you.

     LEGALESE

     You are not allowed to remove or alter these comments.

     You are not allowed to rename, remove, or add any files
     in your public mirror of CPAN.

     "Public mirror of CPAN" means a site listed in
     the SITES.html and SITES files at the top level of CPAN
     and also listed at the site http://mirrors.cpan.org/.

     You are not allowed to alter any file
     in you public mirror of CPAN
     EXCEPT
     that you can add a short acknowledgement for example
     for your hosting company, company, university, or sponsor,
     into this CPAN top-level index.html by adding a small
     non-animated image and a hyperlink pointing to your organization
     with text like "hosted by", "powered by", or "sponsored by",
     by placing it visually next to the "CPAN master site hosted by FUNET"
     acknowledgement at the bottom of the page.
     The image used may not be larger than the one used for the FUNET logo.
         (Technical sidenote: if you do add an acknowledgement link,
         please do think of the consequences to your possible downstream
         CPAN mirrors.)
     Altering this index.html in any other way is not allowed.
     Altering any other files is not allowed.

     Adding any advertisements or any revenue-generating material
     is strictly forbidden.

     Similarly, for your public CPAN mirrors "framing" or "wrapping"
     the CPAN web pages into other sites by using e.g. HTML tables
     or frames is not allowed.

     You are allowed to use the files of CPAN to create your own
     web sites and services since we are just a distributor of the files,
     we do not own most of them.  However, you may not call your creations
     "CPAN" or "CPAN mirrors".  You may say that the files are "mirrored
     from CPAN".

-->
<!-- $Id: index.html,v 1.76 2008/10/25 20:04:53 jhi Exp $ -->
<link rev="made" href="mailto:cpan@perl.org"></link>
<style type="text/css">
<!--

body{
  color:black;
  background:white;
  margin-left:2%;
  margin-right:2%;
}

h1{
  text-align:center;
}

img     {
  vertical-align:        50%;
  border:       0;
}

.left{
  text-align:left;
  float:none;
}

.center{
  text-align:center;
  float:none;
}

.right{
  text-align:right;
  float:none;
}

-->
</style>
</head>
<body>

<table width="100%">
 <tr>
  <td rowspan="2">
   <div class="left">
    <img src="misc/jpg/cpan.jpg"
         alt="[CPAN Logo]" height="77" width="250"/>
   </div>
  </td>
  <td>
   <div class="right">
    <h1><a id="top">Comprehensive Perl Archive Network</a></h1>
   </div>
  </td>
 </tr>
 <tr>
  <td>
    <div class="center">
    2009-05-06 online since 1995-10-26<br/>5536 MB 206 mirrors<br/>7349 authors 15693 modules
    </div>
  </td>
 </tr>
 <tr>
  <td colspan="2">
   <p class="left">
Welcome to CPAN!
Here you will find All Things Perl.
   </p>
  </td>
  <td>
  </td>
 </tr>
</table>

<hr/>

<table width="100%">

<tr>

<td>

<h1>Browsing</h1>
<ul>
  <li><a href="modules/index.html">Perl modules</a></li>
  <li><a href="scripts/index.html">Perl scripts</a></li>
  <li><a href="ports/index.html">Perl binary distributions ("ports")</a></li>
  <li><a href="src/README.html">Perl source code</a></li>
  <li><a href="RECENT.html">Perl recent arrivals</a></li>
  <li><a href="http://search.cpan.org/recent">recent</a> Perl modules</li>
  <li><a href="SITES.html">CPAN sites</a> list</li>
  <li><a href="http://mirrors.cpan.org/">CPAN sites</a> map</li>
</ul>

</td>

<td>

<h1>Searching</h1>

<ul>
<li><a href="http://perldoc.perl.org/">Perl core documentation</a> (perldoc.perl.org; Jon Allen)</li>
<li><a href="http://kobesearch.cpan.org/">Perl core and CPAN modules documentation </a> (Randy Kobes)</li>
<li><a href="http://search.cpan.org/">CPAN modules, distributions, and authors</a> (search.cpan.org)</li>
<!-- a href="http://wait.cpan.org/">CPAN modules documentation</a> (Ulrich Pfeifer) -->
</ul>

<h1>FAQ etc</h1>

<ul>
<li><a href="misc/cpan-faq.html">CPAN Frequently Asked Questions</a></li>
<li><a href="http://faq.perl.org/">Perl FAQ</a></li>
<li><a href="http://lists.cpan.org/">Perl Mailing Lists</a></li>
<li><a href="http://bookmarks.cpan.org/">Perl Bookmarks</a></li>
</ul>

<p><small>
Yours Eclectically, The Self-Appointed Master Librarian (OOK!) of the CPAN<br/>
<i>Jarkko Hietaniemi</i>
<a href="mailto:cpan@perl.org">cpan@perl.org</a>
<a href="disclaimer.html">[Disclaimer]</a>
2001-04-01
</small>
</p>

</td>

</tr>

</table>

<hr/>

<table width="100%">
<tr>

<td>
<div class="left">
<a href="http://validator.w3.org/check?uri=http%3A%2F%2Fwww.cpan.org%2Findex.html">
<img src="misc/gif/valid-xhtml10.gif" alt="Valid XHTML 1.0!" height="31" width="88"/></a>
<a href="http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.cpan.org%2Findex.html"><img src="misc/gif/vcss.gif" alt="[Valid CSS]" height="31" width="88"/></a>
</div>
</td>
<td>
<div class="right">

<table width="100%">

<tr>
<td class="right">
<small>
CPAN master site hosted by
</small>
</td>
</tr>
<tr>
<td class="right">
<a href="http://www.csc.fi/english/institutions/funet_en/about"><img src="misc/gif/funet.gif" alt="FUNET" height="25" width="88"/></a>
</td>
</tr>
</table>

</div>
</td>

</tr>
</table>

</body>
</html>
END
};

my $a = slurp 'www.cpan.org.html';
my $b = $generator->();

eq_or_diff $b, $a;


use Benchmark ':all';

my $r = timethese ($ARGV[0] || -1, { $0 => sub {

    my $html = $generator->();

} }, 'none' );
my $s = cmpthese $r, 'none';
diag($s->[1][1]);
